package base.day19.array;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

public class Collection3 {
    public static void main(String[] args) {
        Collection<String> list=new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add("c");
        list.add("d");
        list.add("e");

        //创建迭代器
        Iterator<String> it=list.iterator();
        while (it.hasNext()){
            String s=it.next();
            if (s.equals("b")){
               it.remove();
            }else {
                System.out.println(s);
            }

        }

    }
}
